package pl.edu.agh.uhm.serveragent.devices.vm;

import java.util.HashMap;
import java.util.Map;
import org.osgi.service.upnp.UPnPAction;
import org.osgi.service.upnp.UPnPService;
import org.osgi.service.upnp.UPnPStateVariable;


public class VMService implements UPnPService{

	final static private String SERVICE_ID = "urn:schemas-upnp-org:serviceId:vmService:1";
	static private String SERVICE_TYPE = "urn:schemas-upnp-org:service:vm:"+VMService.VERSION;
	static VMDevice vmDevice;
	final static private String VERSION = "1";

	private UPnPStateVariable sampleVariable;
	private UPnPStateVariable[] states;
	private Map actions = new HashMap();
	
	
	public VMService(VMDevice vmDevice){
		
		this.vmDevice=vmDevice;
		this.states = new UPnPStateVariable[]{};		
		UPnPAction getNameAction= new GetNameAction();
		this.actions.put(getNameAction.getName(),getNameAction);
		
	}
	
	
	
	public UPnPAction getAction(String name) {
		return (UPnPAction)actions.get(name);
	}

	
	public UPnPAction[] getActions() {
		return (UPnPAction[])(actions.values()).toArray(new UPnPAction[]{});
	}

	
	public String getId() {
		return SERVICE_ID;
	}

	
	public UPnPStateVariable getStateVariable(String name) {
	//	if (name.equals("SampleVariable"))
		///	return sampleVariable;
	//	else 
			return null;
	}

	
	public UPnPStateVariable[] getStateVariables() {
		return states;
	}

	
	public String getType() {
		return SERVICE_TYPE;
	}

	
	public String getVersion() {
		return VERSION;
	}

}
